import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import fire_component_msg from '@feidao/web/atom/browser/fsm/fire-component-msg';

export default async function a004(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	console.log('all_check');
	const all_check = args[0].currentTarget as HTMLInputElement;
	const one_checks = Array.from(fd.data.node.querySelectorAll<HTMLInputElement>('[data-feidao-id="one_check"]'));
	!fd.data.select_staff && (fd.data.select_staff = []);
	one_checks.forEach((one) => {
		if (all_check.checked) {
			one.checked = true;
			const _id = one.getAttribute('_id');
			const staff_number = one.getAttribute('staff_number');
			fd.data.select_staff.push({ _id, staff_number });
		} else {
			one.checked = false;
		}
	});
	console.log('all_check-->', fd.data.select_staff);
}
